{layout "@projectLayout.latte"}
{block content}
<h2 class="block">Kalendář projektu</h2>
<div class="block">
	<div class="block_body">
					  {snippet calendar}
		<table class="calendar">
			{var $started = false}
						  {foreach $weeks as $week}
			<tr>
				<td class="calendar_week">{$week->weekNumber}</td>
							{foreach $week->days as $day}
							{if count($day->events) > 0}{var $started = true}{/if}
				<td class="calendar_day{if $day->isWeekend} calendar_free{/if}{if $started} project{/if}">
					<div class="calendar_day_name">{$day->date|date:D}</div>
					<div class="calendar_day_date">{$day->date|date:'j.n'}</div>
					<div class="clear"></div>
					<div class="events">
						{ifset $day->events[milestones][start]}
						{foreach $day->events[milestones][start] as $milestone}
						<div class="event">
							<img src="{$basePath}/images/start_milestone.gif"> <a n:href=":Project:milestones, $milestone->project[id]">{$milestone[name]}</a>
						</div>
						{/foreach}
						{/ifset}
						{ifset $day->events[milestones][deadline]}
						{foreach $day->events[milestones][deadline] as $milestone}
						<div class="event">
							<img src="{$basePath}/images/deadline_milestone.gif"> <a n:href=":Project:milestones, $milestone->project[id]">{$milestone[name]}</a>
						</div>
						{/foreach}
						{/ifset}
						{ifset $day->events[tasks][start]}
						{foreach $day->events[tasks][start] as $task}
						<div class="event">
							<img src="{$basePath}/images/start_task.gif"> <a n:href=":Task:task, $task[id]">{$task[name]}</a>
						</div>
						{/foreach}
						{/ifset}
						{ifset $day->events[tasks][deadline]}
						{foreach $day->events[tasks][deadline] as $task}
						<div class="event">
							<img src="{$basePath}/images/deadline_task.gif"> <a n:href=":Task:task, $task[id]">{$task[name]}</a>
						</div>
						{/foreach}
						{/ifset}
						{ifset $day->events[projects]}
						{foreach $day->events[projects] as $project}
						{var $started = false}
						<div class="event">
							Deadline projektu
						</div>
						{/foreach}
						{/ifset}
					</div>
				</td>
							{/foreach}
			</tr>
						  {/foreach}

		</table>
					  {/snippet}
	</div>
</div>
{/block}
{block head}
<style>
	.calendar {
		width: 100%;
		border-collapse: collapse;
		font-size: 12px;
		margin-top: 15px;
	}

	.calendar_day {
		width: 14%;
		background-color: #212426;
		border: 1px solid #9faab3;
		height: 110px;
		vertical-align: top;
	}

	.calendar_day.calendar_free {
		background-color: #4b2323;
	}

	.calendar_day.project {
		background-color: #214726;
	}

	.calendar_day.calendar_free.project {
		background-color: #454323;
	}

	.calendar_week {
		background-color: #40474d;
		border: 1px solid #9faab3;
		text-align: center;
		vertical-align: middle;
	}

	.calendar_day_name {
		width: 45%;
		float:left;
		margin-left: 5%;
		margin-top: 5px;
	}
	.calendar_day_date {
		width: 45%;
		float: right;
		margin-right: 5%;
		margin-top: 5px;
		margin-bottom: 5px;
		text-align: right;
	}
	.events .event .event_priority {
		display: inline-block;
		height: 5px;
		width: 5px;
		border: 1px solid black;
	}

	.events .event {
		font-size: 10px;
		margin-bottom: 2px;
	}
</style>
{/block}